package com.webchat.rmi.ugc;


import com.webchat.common.bean.APIResponseBean;
import com.webchat.domain.vo.request.SendRedPacketRequestVO;
import com.webchat.rmi.interceptor.RpcRequestInterceptor;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * webchat 红包服务远程RPC接口声明
 *
 * 问题：为什么红包收发RPC接口要声明在UGC服务，不应该是在PAY支付基础服务吗？
 * 回答：红包收发归属业务场景（类如商城购买商品属于商城订单/下单业务）
 * 而钱包扣除属于基础钱包交易应该由基于PAY服务支持。
 */
@FeignClient(name = "webchat-ugc-service",
        contextId = "redPacketClient",
        configuration = RpcRequestInterceptor.class)
public interface RedPacketClient {

    /**
     * 红包发送 UGC 服务接口声明
     *
     * @param sendRedPacketRequest
     * @return
     */
    @PostMapping("/ugc-service/chat/red-packet/send")
    APIResponseBean<Long> send(@RequestBody SendRedPacketRequestVO sendRedPacketRequest);

    /**
     * 拆红包/抢红包
     *
     * @param redPacketId 红包id
     * @param userId      拆包用户id
     * @return
     */
    @GetMapping("/ugc-service/chat/red-packet/open/{redPacketId}/{userId}")
    APIResponseBean<String> open(@PathVariable Long redPacketId, @PathVariable String userId);

}
